﻿namespace MyCoreLib.UnitTest.Data.Common
{
    using System;
    using System.Data;
    using System.Data.Fakes;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using MyCoreLib.Data.Common.Fakes;


    [TestClass]
    public class DbClientObject_Ctor_Should
    {
        [TestMethod]
        public void NotOpenInnerConnection()
        {
            var connection = new StubIDbConnection
                                 {
                                     Open = () => { throw new InvalidOperationException("The IDbConnection.Open should not be called"); }
                                 };
            var client = new StubDbClientObject(connection);
            Assert.AreEqual(ConnectionState.Closed, client.State, "The initial state of the inner connection object should be {0}.", ConnectionState.Closed);
        }
    }
}
